import { GSprite } from "../../../../com/mui/controls/GSprite";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
type int = number;
//class GTextItem
    
    export  class GTextItem extends GSprite
    {
        constructor(arg1: Object, arg2: int, arg3: int)
        {
            super();
            mouseChildren = false;
            useHandCursor = true;
            buttonMode = true;
            this.init(arg1, arg2, arg3);
            addEventListener(flash.events.MouseEvent.MOUSE_OVER, this.onMouseOverHandler);
            addEventListener(flash.events.MouseEvent.MOUSE_OUT, this.onMouseOutHandler);
            return;
        }

        public set colorSelected(arg1: uint)
        {
            this._colorSelected = arg1;
            return;
        }

        /* internal  */init(arg1: Object, arg2: int, arg3: int): void
        {
            this._textfield = new Object /* flash.text.TextField */();
            this._textfield.textColor = arg1.color;
            this._textfield.htmlText = arg1.text;
            this._textfield.width = arg2;
            this._textfield.height = arg3;
            this._textfield.selectable = false;
            this._textfield.mouseEnabled = true;
            addChild(this._textfield);
            this._colorNormal = arg1.color;
            return;
        }

        public set textformat(arg1: Object /* flash.text.TextFormat */)
        {
            this._textfield.setTextFormat(arg1);
            return;
        }

        public setVline(): void
        {
            var loc1=null;
            loc1 = GlobalClass.getScaleBitmap(ImagesConst.VSpliteLine);
            loc1.width = 1;
            loc1.height = this.height;
            loc1.x = this.width;
            loc1.y = 0;
            addChild(loc1);
            return;
        }

        /* internal  */onMouseOverHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._over_skin == null) 
            {
                this._over_skin = GlobalClass.getScaleBitmap(ImagesConst.Friend_over);
                this._over_skin.width = this.width;
                this._over_skin.height = this.height;
                this._over_skin.x = 0;
                this._over_skin.y = 0;
            }
            addChildAt(this._over_skin, 0);
            return;
        }

        /* internal  */onMouseOutHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (!(this._over_skin == null) && this._over_skin.parent) 
            {
                removeChild(this._over_skin);
            }
            return;
        }

        public addSelectedSkin(): void
        {
            if (this._beSelected_skin == null) 
            {
                this._beSelected_skin = GlobalClass.getScaleBitmap(ImagesConst.Friend_over);
                this._beSelected_skin.width = this.width;
                this._beSelected_skin.height = this.height;
                this._beSelected_skin.x = 0;
                this._beSelected_skin.y = 0;
            }
            addChildAt(this._beSelected_skin, 0);
            if (this._colorSelected != 0) 
            {
                this._textfield.textColor = this._colorSelected;
            }
            return;
        }

        public removeSelectedSkin(): void
        {
            if (!(this._beSelected_skin == null) && this._beSelected_skin.parent) 
            {
                removeChild(this._beSelected_skin);
            }
            if (this._colorSelected != 0) 
            {
                this._textfield.textColor = this._colorNormal;
            }
            return;
        }

        /* internal */ /* var */_textfield: Object /* flash.text.TextField */;

        /* internal */ /* var */_colorNormal: uint;

        /* internal */ /* var */_colorSelected: uint=0;

        /* internal */ /* var */_over_skin: ScaleBitmap;

        /* internal */ /* var */_beSelected_skin: ScaleBitmap;
    }
